﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Windows.Admin.Domain;

namespace Admin.Infrastructure.EFCore.Mappings
{
    public class EmployeeMapping : IEntityTypeConfiguration<Employee>
    {
        public void Configure(EntityTypeBuilder<Employee> builder)
        {
            builder.HasQueryFilter(x => x.IsEnable);
            builder.Property(x => x.UserId).IsRequired(false);
            builder.Property(x => x.Number).HasMaxLength(50);
            builder.Property(x => x.IDCard).HasMaxLength(100);
            builder.Property(x => x.Name).HasMaxLength(20);
            builder.Property(x => x.Gender);
            builder.Property(x => x.Marriage);
            builder.Property(x => x.Education).HasMaxLength(50);
            builder.Property(x => x.MobilePhone).HasMaxLength(50);
            builder.Property(x => x.Email).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.Address).IsRequired(false).HasMaxLength(500);
            builder.Property(x => x.HireDate).HasColumnType("datetime");
            builder.Property(x => x.TermDate).IsRequired(false).HasColumnType("datetime");
            builder.Property(x => x.Avatar).IsRequired(false).HasMaxLength(500);
            builder.Property(x => x.Status);
            builder.Property(x => x.Remark).IsRequired(false).HasMaxLength(500);
        }
    }
}
